]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
places: Fail gracefully when not using unstable nautilus
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 16 Jan 2011 19:21:10 +0000 (20:21 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 17 Jan 2011 16:46:37 +0000 (17:46 +0100)
The latest development version of nautilus has been ported to
GSettings, which we now use as well for the desktop-is-home-dir
preference. Obviously, the required schema is only available if
a recent enough nautilus version is installed. Instead of adding
yet another module to the moduleset, catch the exception and
ignore the preference in case the schema is not available.

https://bugzilla.gnome.org/show_bug.cgi?id=639689

js/ui/placeDisplay.js

index 80f632c48b86c400d1953990851aa839f459b56b..4bbdb06fcba554c450959aecaa0c43faac73367c 100644 (file)
@@ -125,11 +125,24 @@ PlacesManager.prototype = {
         this._mounts = [];
         this._bookmarks = [];
 
-        this._settings = new Gio.Settings({ schema: NAUTILUS_PREFS_SCHEMA });
-        this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
-        this._settings.connect('changed::' + DESKTOP_IS_HOME_KEY,
-                               Lang.bind(this,
-                                         this._updateDesktopMenuVisibility));
+        this._settings = null;
+        this._isDesktopHome = false;
+
+        // The GNOME3 version of nautilus has been ported to GSettings; we
+        // don't require it though, so for now we'll have to deal with the
+        // case of GNOME3 nautilus not being installed.
+        try {
+            this._settings = new Gio.Settings({ schema: NAUTILUS_PREFS_SCHEMA });
+        } catch (e) {
+            log('Failed to get settings from Nautilus. Places may not work as expected');
+        }
+
+        if (this._settings != null) {
+            this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
+            this._settings.connect('changed::' + DESKTOP_IS_HOME_KEY,
+                                   Lang.bind(this,
+                                             this._updateDesktopMenuVisibility));
+        }
 
         let homeFile = Gio.file_new_for_path (GLib.get_home_dir());
         let homeUri = homeFile.get_uri();